package com.woniu02;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class Test03 {
    public static void main(String[] args) {
        //map嵌套map
        Student s11 = new Student(1,"zs",11);
        Student s12 = new Student(2,"ls",12);
        Map<Integer,Student> class1 = new HashMap<Integer,Student>();
        class1.put(1,s11);
        class1.put(2,s12);

        Student s21 = new Student(1,"ww",13);
        Student s22 = new Student(2,"zl",14);
        Map<Integer,Student> class2 =new HashMap<>();
        class2.put(1,s21);
        class2.put(2,s22);


        Map<Integer,Map<Integer,Student>> school = new HashMap<>();
        school.put(1,class1);
        school.put(2,class2);

        Set<Map.Entry<Integer, Map<Integer, Student>>> entries = school.entrySet();
        for(Map.Entry<Integer, Map<Integer, Student>> myclass : entries){
            Set<Map.Entry<Integer, Student>> zclass = myclass.getValue().entrySet();
            for(Map.Entry<Integer, Student> student
                    :zclass){
                System.out.println(student.getKey());
                System.out.println(student.getValue());
            }
        }
    }
}
